package cn.lxh.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.lxh.pojo.app.dto.WxLoginDto;
import cn.lxh.result.JSONResult;
import cn.lxh.service.ILoginService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;


@Tag(name = "微信登录",description = "微信登录")
@RestController
@RequestMapping("/app/login")
public class AppLoginController {

    @Autowired
    public ILoginService loginService;

    @Operation( summary= "微信登录",description = "微信登录")
    @Parameter(name = "loginDto",description = "loginDto封装了wxCode和type",required = true)
    @PostMapping("/mpLogin")
    @SaIgnore // 不做登录校验
    public JSONResult mpLogin(@RequestBody @Valid WxLoginDto wxLoginDto){
        return JSONResult.success(loginService.mpLogin(wxLoginDto));
    }

}
